const mongo = require('mongoose')

mongo.connect('mongodb://localhost/bokea')
const conn = mongo.connection

conn.on('err', (err) => {
    console.log('数据库连接失败', err)
})
conn.on('open', () => {
    console.log('数据库打开成功')
})

exports.User = mongo.model('users', {
    petname: String,
    password: String,
    email: String
})

exports.Question = mongo.model('questions', {
    petname: String,
    time: Date,
    title: String,
    ele1: String,
    ele2: String,
    ele3: String,
    count1:String,
    count2:String,
    content: String,
    answers: [{
        content: String,
        petname: String,
        time: Date,
        email: String,
        url: String
    }]
})